﻿<UserControl x:Class="CrossRoadNS.Views.UserControls.CellUc"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv="clr-namespace:CrossRoadNS.Services.Converters"
             xmlns:uc="clr-namespace:CrossRoadNS.Views.UserControls"
             mc:Ignorable="d">
    <UserControl.Resources>
        <conv:CellStaticStateToColorConv x:Key="staticConv"/>
        <conv:CellDynamicStateToColorConv x:Key="dynamicConv"/>
        <conv:IntToColorConv x:Key="carColorConv"/>
        <conv:TrafficLightStateToColorConv x:Key="TlConv"/>
        <conv:CarVisualDirectionConverter x:Key="carVD" />
    </UserControl.Resources>
    <Grid>
        <!--cell state-->
        <Rectangle Width="50" Height="50"
                   Fill="{Binding State, Converter={StaticResource staticConv}}" />
        <!--traffic light state-->        
        <Border Width="50" Height="50" CornerRadius="10" BorderThickness="5"
                BorderBrush="{Binding Path=trafficLight.State.FState, Converter={StaticResource TlConv}}" />
        <!--car color-->
        <Rectangle Width="25" Height="25"
                   Fill="{Binding Path=car.color, Converter={StaticResource carColorConv}}" />
        <!--car visual direction-->
        <TextBlock Text="{Binding car, Converter={StaticResource carVD}}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Visibility="Collapsed"/>
        <uc:CarVisualDirectionUc Direction="{Binding Path=car, Converter={StaticResource carVD}}"/>
        <!--cell index-->
        <TextBlock Text="{Binding index}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Visibility="Collapsed"/>
    </Grid>
</UserControl>
